using UnityEngine;
using System.Collections;

public class ParticleAutoDestroy : MonoBehaviour 
{

	// Use this for initialization
	void Start () 
	{
		//Starting the co-routine
		StartCoroutine(_ParticleAutoDestroy());
	}
	
	private IEnumerator _ParticleAutoDestroy()
	{
		//Let's wait for the particles to emit
		yield return new WaitForSeconds(particleSystem.duration);
		
		//Destroy the gameObject
		Destroy(gameObject);
	}
}
